/*
 * ThreadMotorController.h
 *
 *  Created on: Jan 26, 2013
 *      Author: Drew Prevost
 */

#ifndef THREADMOTORCONTROLLER_H_
#define THREADMOTORCONTROLLER_H_

#include <Protothread.h>
#include "Arduino.h"
#include "ThreadMicroDelay.h"

class ThreadMotorController: public Protothread
{
public:
  ThreadMotorController( int nPin );
  virtual ~ThreadMotorController();

  int getSpeed();
  void setSpeed( int nTargetSpeed, unsigned long nAccRateInMicrosPerAcc );

  virtual bool run();

protected:
  ThreadMicroDelay threadMicroDelay;
  int nPin;
  int nCurSpeed;
  int nTargetSpeed;
  unsigned long nAccRateInMicrosPerAcc;
  //unsigned long nLastAccTimestampInMicros;
};

#endif /* THREADMOTORCONTROLLER_H_ */
